<?php
$this->headScript()->appendFile($this->publicUrl . "Scripts/jquery.js");
?>
<h2><?= $this->translate('Settings') ?></h2>
<?= $this->form ?>

<script type="text/javascript"> 
    $(document).ready(
        function() { 
            $("#selectTemplate").change( function() {
            		$("#submit").attr("disabled","");
                    $("#show").html("loading");
                    $.get("<?= $this->url(array('action' => 'skins-ajax-request', 'controller' => 'user')) ?>", 
                        {template: $("#selectTemplate option:selected:first").text()}, function(json) {
                                $("#selectSkin option").remove();
                                var skins = eval('(' + json + ')');
                                for ( var i=0; i<skins.length; i++ )
                                    $("#selectSkin").append("<option value="+skins[i]+">"+skins[i]+"</option>");
                                $("#show").html(""); 
                                $("#submit").removeAttr("disabled");                               
                            }
                        )                   
                }
            )
        });
</script>

<div id="show"></div>